﻿using AnesSystem.Models;
using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// ConfigContainersDataGrid.xaml 的交互逻辑
    /// </summary>
    public partial class ConfigContainersDataGrid : UserControl
    {
        public ConfigContainersDataGrid()
        {
            InitializeComponent();
            _DisplayConfigContainersModels.LoadingRow += _DisplayConfigContainersModels_LoadingRow;
            this.DataContext = ConfigContainersCtrlViewModel.Instance;
        }
        //生成序号
        private void _DisplayConfigContainersModels_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = e.Row.GetIndex() + 1;
        }

        private void del_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBoxCommon.ShowDialog("确定要删除此单位?", MessageBoxCommon.OKCANCLE).Value == true)
            {
                ConfigContainersCtrlViewModel.Instance.DelConfigContainersModel((sender as Button).DataContext as ConfigContainersModel);
            }
            else
            {
                return;
            }

        }
       

    }
}
